extends Control

onready var tex_rect: TextureRect = $VBoxContainer/ScrollContainer/TextureRect
onready var filename_dropdown: OptionButton = $VBoxContainer/HBoxContainer/FileName

func _ready():
	for s in "ABCDEFGHIJKL":
		filename_dropdown.add_item(s)
	filename_dropdown.selected = 0

func _on_Create_pressed():
	if filename_dropdown.selected < 0:
		return

	var sky_name: String = filename_dropdown.get_item_text(filename_dropdown.selected)

	var skybox: BallanceSky = load("res://skybox/BallanceSky%s.tres" % sky_name)
	skybox.generate("user://panorama.png")

	tex_rect.texture = skybox.panorama
	tex_rect.rect_size = skybox.panorama.get_size()
